package com.jack.lib.core.ext

import kotlinx.coroutines.*

/**
 * author : chong.huang
 * create : 2021/12/31
 * desc   :
 */



fun CoroutineScope.delayLaunch(timeMills: Long, init: CoroutineScope.() -> Unit): Job {
    check(timeMills >= 0) { "timeMills must be positive" }
    return launch(Dispatchers.Main) {
        delay(timeMills)
        init()
    }
}